<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--javascript  基本语法-->
<script type="text/html">
    var arr = new Array('dgf');
    //构造函数
    var arr1 = new Array(20,45,'fsd',arr);
    //字面量创建数组
    var  arr2 = [true,531,4312];
    arr2.length = 1;

    console.log(arr,arr1[0],arr2.length);
    console.log(arr2.length,);
</script>
<script type="text/html">
    var peson = ['jack','man',33];
    var person1 = [10,42,224,545,212,545,2,45,5];

    for(var i = 0;i<person1.length;i++)
    {
        var item = person1[i];
        if (item % 2 != 0) {
            console.log('奇数：' + item);
        } else {
            console.log('偶数：' + item);

        }

    }

</script>
<script type="text/html">
    //join
    var  arr = [23,1,4,21,6,'jack'];
    var  string = arr.join();
    console.log(arr.join());
    console.log(typeof (string));

</script>
<script type="text/html">
    // push and pop
    var arr = [5421,42,12,12,12];
    console.log('push'+arr.push('jack','rose'));//返回长度
    console.log('pop'+arr.pop());//移除最后一个对象
    console.log(arr);
</script>
<script type="text/html">
    //head ----shift:delete from start, unshift:add from star
    var arr = ['jack','cass','jay','rose'];
//    console.log(arr.shift());
//    arr.unshift('qsd','da');
    console.log(arr.reverse());//反转数组顺序
    console.log(arr.concat([1142, 42]));;


</script>
<script type="text/html">
    //indexof start from head,
    //lastindexof start from foot
    //都是返回要查找的内容的index
    var arr = [212,312,221,10];
    console.log(arr.indexOf(10));//index （查找内容，从哪个index开始）

</script>
<script>
//
</script>
</body>
</html>